package xx.pro.consumer.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import static xx.pro.common.constans.Constants.*;

@Slf4j
@Component
public class FaoutConsumer {

    /**
     * 扇形交换机-消费者 faout.a
     *
     * @param message
     */
    @RabbitListener(queues = FAOUT_A)
    public void faoutAconsumer(Message message) {
        String msg = new String(message.getBody());
        System.out.println("Faout A 消费者收到消息  : " + msg);
    }

    /**
     * 扇形交换机-消费者 faout.b
     *
     * @param message
     */
    @RabbitListener(queues = FAOUT_B)
    public void faoutBconsumer(Message message) {
        String msg = new String(message.getBody());
        System.out.println("Faout B 消费者收到消息  : " + msg);
    }

    /**
     * 扇形交换机-消费者 faout.c
     *
     * @param message
     */
    @RabbitListener(queues = FAOUT_C)
    public void faoutCconsumer(Message message) {
        String msg = new String(message.getBody());
        System.out.println("Faout C 消费者收到消息  : " + msg);
    }
}
